FROM python:3.12-slim


ENV PIP_PYPI_URL=https://mirror.nju.edu.cn/pypi/web/simple

RUN pip install pip -U -i ${PIP_PYPI_URL} && \
    pip config set global.index-url ${PIP_PYPI_URL}

ENV TZ=CST-8
ENV PYTHONPATH=/app
ENV PROJECT_ROOT=app

WORKDIR /app

RUN curl -LsSf https://astral.sh/uv/install.sh | sh
COPY uv.lock /app
RUN uv pip compile uv.lock -o requirements.txt && \
    uv pip install -r requirements.txt

ENV PATH="/app/.venv/bin:$PATH"
COPY src /app

CMD ["uvicorn", "fastapi_template.webapp:create_app", "--host", "0.0.0.0", "--port", "8080", "--log-config", "uvicorn_disable_logging.json"]
